import {getChineseAllDistinguish} from "@/utils/MapUtils.js";
import {getProductCategoryAllAPI} from "@/api/product.js";

/**
 * 获取地址选项数据
 */
export const getAddrSelectOptions = async (chineseAllDistinguish, provinceSelectOptions) => {
    // 获取全国区县数据
    chineseAllDistinguish.value = await getChineseAllDistinguish();
    provinceSelectOptions.value = chineseAllDistinguish.value.map(item => ({value: item.name, label: item.name}))
}

/**
 * 获取全部商品分类选项数据
 *
 * @returns {Promise<void>}
 */
export const getProductCategoryOptions = async (productCategoryAll, productCategoryOptions) => {
    // 获取全部商品分类
    productCategoryAll.value = await getProductCategoryAllAPI()
    productCategoryOptions.value = productCategoryAll.value.map(
        item => ({value: item.id, label: item.name})
    )
}